package com.ms.service.impl;

import com.ms.mapper.UserLeaveMapper;
import com.ms.pojo.Leave_apply;
import com.ms.service.UserLeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;

@Service
public class UserLeaveServiceImpl implements UserLeaveService {
    @Autowired
    private UserLeaveMapper userLeaveMapper;

    @Override
    public int insertLeaveApply(Leave_apply leave_apply) {
        try {
            // 先设置登录信息的默认值
            leave_apply.setStartTime(new Date());
            leave_apply.setEndTime(new Date());
            leave_apply.setLeaveDays(BigDecimal.valueOf(1));
            leave_apply.setApplyTime(new Date());
            leave_apply.setApplyStatus(0); // 0表示待审批
            leave_apply.setApproverId(1);
            leave_apply.setLeaveType(1);
            leave_apply.setReason("测试");
            leave_apply.setEmpId(1);



        }
        catch (Exception e) {
            e.printStackTrace();

        }
        return userLeaveMapper.insertLeaveApply(leave_apply);
    }
}
